package com.cw.demo.springbean;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import lombok.extern.slf4j.Slf4j;

/**
 * TODO
 *
 * @author chenw
 * @date 2021/1/8
 */
@Slf4j
public class BeanlifeCircleTest {
    public static void main(String[] args) {
        log.info("现在开始初始化容器");
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("Beans.xml");
        log.info("容器初始化成功");
        Person person = applicationContext.getBean("person",Person.class);
        log.info(person.getPhone());
        log.info("现在开始关闭容器");
        ((ClassPathXmlApplicationContext)applicationContext).registerShutdownHook();
    }
}
